package factory.simpleFactory;

import factory.simpleFactory.pizza.AbstractPizza;
import factory.simpleFactory.pizza.CheesePizza;
import factory.simpleFactory.pizza.GreekPizza;
import factory.simpleFactory.pizza.LdPizza;

/**
 * @author zhouyang
 * @title: PizzaFactory
 * @projectName DesignMode_Java
 * @description: 专门负责生产pizza的类
 * @date 2019/5/25 19:48
 */
public class PizzaFactory {
    public AbstractPizza createPizza(String type){
        AbstractPizza abstractPizza = null;
        if(type.equals("CheesePizza")) abstractPizza = new CheesePizza();
        else if(type.equals("GreekPizza")) abstractPizza = new GreekPizza();
        else if(type.equals("LdPizza")) abstractPizza = new LdPizza();
        else System.err.println("unexcepted pizza");
        return abstractPizza;
    }
}
